home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
basic
/
qbware.exe
/
FTIME.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-11-30
|
3KB
|
116 lines
DECLARE SUB FlFind (FlSpec$, BYVAL Addr%)
'*****************************************************************************
'Copyright (c) 1987,1988 Marcel Madonna
'FTIME.BAS shows the use of some of the DOS file management services.
'
' ********************* N O T E *************************
'
'This program cannot be used from the DOS prompt without Microsoft
'QuickBasic V4.0 and a registered copy of QBWARE.
'
'To compile it, at the DOS prompt type:
' bc look;
' link /ex /noe look,,,brun40 qbware;
' del look.obj
' del look.map
'To run it fromthe QuickBasic development environment, type:
'
' qb look /l qbware
' [Shift] + F5
'To execute FTIME just type "FTIME" at the DOS prompt and this program will
'change the date and time stamps on each file in the current directory to
'the current date and time
'
'This is a pretty simple program - it can be modified to accept a file
'specification from the command line or to bypass hidden or system files, etc.
'*****************************************************************************
OPTION BASE 1
CLS
PRINT "FTIME - Version 1.0 (C) Copyright 1987,1988 AJM Software"
LOCATE 3, 1
PRINT "This program will alter the timestamps on every file"
PRINT "in this directory"
PRINT
PRINT "Enter (Y)es to continue"
PRINT "...Any other key aborts"
x$ = INKEY$ 'Clear the keyboard buffer
WHILE x$ <> ""
x$ = INKEY$
WEND
x$ = ""
WHILE x$ = ""
x$ = INKEY$
WEND
IF x$ <> "Y" AND x$ <> "y" THEN END
GOTO A5000.Mainline
A0500.Dim.Array:
REDIM Dirlist$(Count%) 'Dimension the array fo FLFIND
FOR x% = 1 TO Count% 'Initialize each element of array
Dirlist$(x%) = SPACE$(40) 'to 40 blanks
NEXT
RETURN
A1000.Get.Dirlist:
CALL Flcnt(FlSpec$, Count%) 'Get a count of matching files
IF Count% <> 0 THEN
GOSUB A0500.Dim.Array
CALL FlFind(FlSpec$, VARPTR(Dirlist$(LBOUND(Dirlist$))))
END IF
RETURN
A5000.Mainline:
' Retrieve current date and time
NFDate$ = DATE$
NFTime$ = TIME$
' Let's get all files in the current directory
FlSpec$ = "*.*" + CHR$(0) 'Complete file directory
GOSUB A1000.Get.Dirlist
x% = 1 'Initialize counter
WHILE x% <= Count%
Xfname$ = MID$(Dirlist$(x%), 28, 12)
Fattr$ = MID$(Dirlist$(x%), 1, 5)
' We'll exclude directories
IF INSTR(Fattr$, "D") = 0 THEN 'let's exclude directories
CALL FlPDat(Xfname$ + CHR$(0), NFDate$, NFTime$, Rc%)
IF Rc% = 0 THEN
Tot.files% = Tot.files% + 1
ELSE
PRINT "Error "; Rc%; " on file" + Xfname$
END IF
END IF
x% = x% + 1
WEND
PRINT Tot.files%; " files updated successfully"
END